package com.example.springboot.util;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;

import java.io.File;
import java.io.IOException;

/**
 * @auther: Wyz
 * @date: 2023/5/8 16:09
 * @return
 */
public class MyUtils {

    public static void main(String[] args){

        String url = "https://lfrz1.stor.enncloud.cn/ennew-pro/public/qT8I30Ep8LClHsA9/archives-service-sync/506d32548e3d4bd9a9d66175a1870ab23.pdf";
        String url1 = "https://lfrz1.stor.enncloud.cn/ennew-pro/public/qT8I30Ep8LClHsA9/archives-service-sync/046116fd5e0940bfb6b08e786f195b102.pdf";


        PDDocument document = null;
        try {
            document = PDDocument.load(new File("path/to/pdf/file.pdf"));
        } catch (InvalidPasswordException e) {
            System.err.println("Invalid password for PDF file.");
        } catch (IOException e) {
            System.err.println("Unable to read PDF file.");
        }
        if (document != null) {
            try {
                document.close();
            } catch (IOException e) {
                System.err.println("Unable to close PDF document.");
            }
        }
    }
}
